<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>添加内容</title>
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <link rel="stylesheet" href="__STATIC__/css/layui.css">
    <script src="__STATIC__/layui.js"></script>
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>

<body>
<div class="panel admin-panel">
    <div style="margin-bottom: 1%" class="panel-head"><strong class="icon-reorder">费用报销单详情</strong>&emsp;&emsp;<a
            style="color: #3a4bfb;font-weight: bold " href="javascript:history.go(-1)">返回上一步</a></div>
    <lable style="margin-left: 1%;" class="layui-form-lable">
        审批记录：
    </lable>
    <div>
        <span style="margin-left: 3%">审批级别：</span>{$leaves_form.role}&emsp;&emsp;<span>审批结果：{$leaves_form.apply_state}</span>
    </div>
    <div style="margin-top: 2%">
        {if condition="$leaves_form.apply_states eq 2"}
        <form class="layui-form">
            <h3 style="text-align: center;margin-top: 2%;margin-bottom: 2%"><b>请假申请表</b></h3>
            <div style="margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    请假类型：
                </lable>
                <div class="layui-input-inline">
                    <select id="type_leave" name="type_leave" lay-search="">
                        {volist name="type_leave" id="tl"}
                        <option value="{$tl.type_leave}">{$tl.type_leave}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <input type="hidden" value="4" name="bill_type_id">
            <input type="hidden" value="{$leaves_form.id}" name="id">
            <div style=" margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    审批流程：
                </lable>
                <div class="layui-input-inline">
                    <select id="leave_flow_id" name="leave_flow_id">
                        {volist name="leaves_form_flow" id="vo"}
                        {if condition="$vo.id eq $leaves_form.leave_flow_id"}
                        <option selected="selected" value="{$vo.id}">{$vo.flow}</option>
                        {else /}
                        <option value="{$vo.id}">{$vo.flow}</option>
                        {/if}
                        {/volist}
                    </select>
                </div>
            </div>
            <table style="margin-top: 2%    " class="layui-table" lay-size="lg">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="150">
                <col width="150">
                <tr>
                    <td style="text-align: center;vertical-align: middle">姓名：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.ch_name}
                    </td>
                    <td style="text-align: center;vertical-align: middle">部门：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.branch}
                    </td>
                    <td style="text-align: center;vertical-align: middle">岗位/职务：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.position}
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea name="off" placeholder="调休必须到考勤管理部门核对有效的加班时间，并列出抵充时间。"
                                              class="layui-textarea">{$leaves_form.off}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                            <textarea name="leave_ask" placeholder="请假补充说明：" class="layui-textarea">{$leaves_form.leave_ask}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea name="job_agent" placeholder="职务代理人（三天以上的假期必须填写）："
                                              class="layui-textarea">{$leaves_form.job_agent}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea name="handover" placeholder="有无工作交接情况，如有请列出交接事宜（三天以上的假期必须填写）："
                                              class="layui-textarea">{$leaves_form.handover}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">请假时间：</td>
                    <td colspan="3">
                        <input class="layui-input" value="{$leaves_form.leave_time}" lay-verify="required" name="leave_time" id="leave_time"
                               placeholder="开始 到 结束" type="text">
                    </td>
                    <td style="text-align: center;vertical-align: middle">申请时间：</td>
                    <td><input class="layui-input" value="{$leaves_form.leave_form_time}" lay-verify="date|required" placeholder="yyyy-MM-dd"
                               name="leave_form_time" id="leave_form_time" type="text"></td>
                </tr>
            </table>
            <div class="layui-form-item">
                <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="demo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
        {else /}
        <form class="layui-form">
            <h3 style="text-align: center;margin-top: 2%;margin-bottom: 2%"><b>请假申请表</b></h3>
            <div style="margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    请假类型：
                </lable>
                <div class="layui-input-inline">
                    <select lay-search="">
                        <option>{$leaves_form.type_leave}</option>
                    </select>
                </div>
            </div>
            <div style=" margin-left: 3%" class="layui-inline">
                <lable style="float: left;margin-top: 3%" class="layui-form-lable">
                    审批流程：
                </lable>
                <div class="layui-input-inline">
                    <select>
                        <option>{$leaves_form.flow}</option>
                    </select>
                </div>
            </div>
            <table style="margin-top: 2%    " class="layui-table" lay-size="lg">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="100">
                <col width="150">
                <col width="150">
                <tr>
                    <td style="text-align: center;vertical-align: middle">姓名：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.ch_name}
                    </td>
                    <td style="text-align: center;vertical-align: middle">部门：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.branch}
                    </td>
                    <td style="text-align: center;vertical-align: middle">岗位/职务：</td>
                    <td style="text-align: center;vertical-align: middle">
                        {$leaves_form.position}
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea readonly="readonly" placeholder="调休必须到考勤管理部门核对有效的加班时间，并列出抵充时间。"
                                              class="layui-textarea">{$leaves_form.off}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                            <textarea readonly="readonly" placeholder="请假补充说明：" class="layui-textarea">{$leaves_form.leave_ask}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea readonly="readonly" placeholder="职务代理人（三天以上的假期必须填写）："
                                              class="layui-textarea">{$leaves_form.job_agent}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;vertical-align: middle">
                        <div style="margin-left: 0" class="layui-input-block">
                                    <textarea readonly="readonly" placeholder="有无工作交接情况，如有请列出交接事宜（三天以上的假期必须填写）："
                                              class="layui-textarea">{$leaves_form.handover}</textarea>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="text-align: center;vertical-align: middle">请假时间：</td>
                    <td colspan="3">
                        <input readonly="readonly" class="layui-input" value="{$leaves_form.leave_time}"
                               placeholder="开始 到 结束" type="text">
                    </td>
                    <td style="text-align: center;vertical-align: middle">申请时间：</td>
                    <td><input readonly="readonly" class="layui-input" value="{$leaves_form.leave_form_time}" placeholder="yyyy-MM-dd"
                                type="text"></td>
                </tr>
            </table>
            <div class="layui-form-item">
                <div style="float: right;margin-top: 2%;margin-right: 10%" class="layui-input-block">
                </div>
            </div>
        </form>
        {/if}

    </div>
</div>
<a style="margin-top: 2%;float: right;margin-right: 35%;margin-bottom: 3%" class="layui-btn" href="{:url('Myself/myselfapprove')}">返回</a>

<a style="margin-top: 2%;float: right;margin-right: 15%;margin-bottom: 3%" class="layui-btn" href="{:url('Myself/leaves_form_excel')}?id={$leaves_form.id}">下载单据打印表格</a>
</body>
<script>
    layui.use('element', function () {
        var $ = layui.jquery
            , element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function () {
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项' + (Math.random() * 1000 | 0) //用于演示
                    , content: '内容' + (Math.random() * 1000 | 0)
                    , id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }

        };

        $('.site-demo-active').on('click', function () {
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function (elem) {
            location.hash = 'test=' + $(this).attr('lay-id');
        });

    });
</script>
<script>
    layui.use(['form', 'layer', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;

        //日期时间范围
        laydate.render({
            elem: '#leave_time'
            , type: 'datetime'
            , range: true
        });
        //日期
        laydate.render({
            elem: '#leave_form_time'
        });
        //自定义验证规则
        form.verify({
            num: [/^[0-9]+(.[0-9]{2})?$/, '金额只能为数字']

        });
        //监听提交
        form.on('submit(demo)', function (data) {
            var datas = JSON.stringify(data.field);
            var sub = 'submit';
            $.ajax({
                type: "post",
                url: "{:url('Myself/myselfapprove_leaves_form_saves')}",
                data: {"data": datas, 'sub': sub},
                dataType: "json",
                success: function (a) {
                    //console.log(a);
                    if (a > 0) {
                        layer.msg('添加成功', {icon: 1});
                        //layer.close(index);
                        window.setTimeout("window.location=\"{:url('Myself/myselfapprove')}\"", 2000);
                    } else {
                        layer.msg('添加失败', {icon: 2});
                        //layer.close(index);
                        setTimeout(function () {
                            //使用  setTimeout（）方法设定定时2000<a href="https://www.baidu.com/s?wd=%E6%AF%AB%E7%A7%92&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dWuHn4n1DkmynYmhu9uhcd0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHf4PWmsrHRdnWckPWnkrHmkrf" target="_blank" class="baidu-highlight">毫秒</a>
                            window.location.reload();//页面刷新
                        }, 2000);
                    }

                }

            });
            return false;
        });

    });
</script>
<script>
    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload
            , layer = layui.layer;

        //拖拽上传
        upload.render({
            elem: '#test10'
            , accept: 'file'
            , url: "{:url('Apply/upload')}"
            , auto: false
            , bindAction: '#uploads'
            , done: function (res) {
                if (res.code == 0) { //上传成功
                    layer.msg('上传成功', {icon: 1})
                }
                else if (res.code == 1) { //上传成功
                    layer.msg('上传成功1', {icon: 1})
                }
            }
        });
    });
</script>
</html>